package com.yhsimon.prototype.impove;

public class Client {
    public static void main(String[] args) {
        System.out.println("原型模式完成对象的创建：");
        Sheep sheep = new Sheep("Tom", 1, "白色");
        sheep.friend=new Sheep("Cary",3,"黑色");

        Sheep sheep1 = (Sheep) sheep.clone();//克隆
        System.out.println(sheep1.toString());
        //新增属性后
        System.out.println(sheep1.toString());

        //克隆时 属性中的对象该如何处理  （软拷贝）
        System.out.println(sheep.friend.toString()+sheep.friend.hashCode());
        System.out.println(sheep1.friend.toString()+sheep1.friend.hashCode());
    }
}
